#ifndef __tenacitas_interlace_text_core_coordinate_tester_h__
#define __tenacitas_interlace_text_core_coordinate_tester_h__

#include <iostream>
#include <cstdint>
#include <string>
#include <limits>

#include "runtest.h"

#include <tenacitas.interlace_text.core/coordinate.h>

namespace tenacitas {
    namespace interlace_text {
        namespace core {


            class coordinate_tester {

            private:
                struct supplier {
                    typedef string text;
                    struct interlace{};
                };
            


                static bool test1() {
                    std::cerr << "\n+++ coordinate_tester::test1" << std::endl;
                    
                    coordinate<supplier> _c;
                    
                    std::cerr <<  _c << std::endl;
                    
                    return true;
                }

                static bool test2() {
                    std::cerr << "\n+++ coordinate_tester::test2" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c;
                    
                    return ( 
                        (_c.get_line() == coordinate::invalid_position) &&
                        (_c.get_column() == coordinate::invalid_position) &&
                        (_c.get_letter() == coordinate::invalid_letter)
                        );
                }

                static bool test3() {
                    std::cerr << "\n+++ coordinate_tester::test3" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c;
                    
                    return ( !_c.is_positioned());
                }

                static bool test4() {
                    std::cerr << "\n+++ coordinate_tester::test4" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c(-3, 5, 'u');
                    
                    return ( _c.is_positioned());
                }

                static bool test5() {
                    std::cerr << "\n+++ coordinate_tester::test5" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c(-3, 5, 'u');

                    std::cerr << _c << std::endl;
                    
                    
                    return ( 
                        (_c.get_line() == -3) && 
                        (_c.get_column() == 5) &&
                        (_c.get_letter() == 'u')
                        );
                    
                }

                static bool test6() {
                    std::cerr << "\n+++ coordinate_tester::test6" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c(-3, 5, 'u');

                    std::cerr << _c << std::endl;

                    _c.set_line(18);
                    _c.set_column(-7);
                    _c.set_letter('k');
                    
                    std::cerr << _c << std::endl;                    
                    
                    return ( 
                        (_c.get_line() == 18) && 
                        (_c.get_column() == -7) &&
                        (_c.get_letter() == 'k')
                        );
                    
                }

                static bool test7() {
                    std::cerr << "\n+++ coordinate_tester::test7" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c(-3, 5, 'u');

                    std::cerr << _c << std::endl;

                    _c.unposition();
                    
                    std::cerr << _c << std::endl;                    
                    
                    return (!_c.is_positioned());
                }

                static bool test8() {
                    std::cerr << "\n+++ coordinate_tester::test8" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c1(-3, 5, 'u');
                    coordinate _c2(-3, 5, 'u');

                    std::cerr << _c1 << std::endl;
                    std::cerr << _c2 << std::endl;

                    return (_c1 == _c2);
                }

                static bool test9() {
                    std::cerr << "\n+++ coordinate_tester::test9" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c1(-3, 5, 'u');
                    coordinate _c2(-3, 5, 'o');

                    std::cerr << _c1 << std::endl;
                    std::cerr << _c2 << std::endl;

                    return (_c1 != _c2);
                }
                
                static bool test12() {
                    std::cerr << "\n+++ coordinate_tester::test12" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c1(-3, 5, 'u');
                    coordinate _c2;
                    
                    _c2 = _c1;

                    std::cerr << _c1 << std::endl;
                    std::cerr << _c2 << std::endl;

                    return (_c1 == _c2);
                }

                static bool test13() {
                    std::cerr << "\n+++ coordinate_tester::test13" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c1(-3, 5, 'u');
                    coordinate _c2;

                    std::cerr << _c1 << std::endl;
                    std::cerr << _c2 << std::endl;
                    
                    _c2 = std::move(_c1);

                    std::cerr << _c1 << std::endl;
                    std::cerr << _c2 << std::endl;

                    return (_c1 == _c2);
                }

                static bool test14() {
                    std::cerr << "\n+++ coordinate_tester::test14" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c1(-3, 5, 'u');
                    std::cerr << _c1 << std::endl;
                    
                    coordinate _c2(_c1);

                    std::cerr << _c1 << std::endl;
                    std::cerr << _c2 << std::endl;

                    return (_c1 == _c2);
                }

                static bool test15() {
                    std::cerr << "\n+++ coordinate_tester::test15" << std::endl;
                    
                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c1(-3, 5, 'u');
                    std::cerr << _c1 << std::endl;

                    coordinate _c2(std::move(_c1));

                    std::cerr << _c1 << std::endl;
                    std::cerr << _c2 << std::endl;

                    return (_c1 == _c2);
                }

                static bool test16() {
                    // testing that the 'operator <' was not defined
                    std::cerr << "\n+++ coordinate_tester::test16" << std::endl;

                    typedef core::coordinate<supplier> coordinate;

                    coordinate _c1(-3, 5, 'u');
                    coordinate _c2(9,1,'q');

                    std::cerr << _c1 << std::endl;
                    std::cerr << _c2 << std::endl;
#if 0                    
                    return (_c1 < _c2);
#endif
#if 1
                    return true;
#endif
                }
                

            public:
                static void run() {
                    runtest(coordinate_tester::test1());
                    runtest(coordinate_tester::test2());
                    runtest(coordinate_tester::test3());
                    runtest(coordinate_tester::test4());
                    runtest(coordinate_tester::test5());
                    runtest(coordinate_tester::test6());
                    runtest(coordinate_tester::test7());
                    runtest(coordinate_tester::test8());
                    runtest(coordinate_tester::test9());
                    runtest(coordinate_tester::test12());
                    runtest(coordinate_tester::test13());
                    runtest(coordinate_tester::test14());
                    runtest(coordinate_tester::test15());
                    runtest(coordinate_tester::test16());
                }

            };

        }
    }
}

#endif
